<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/own.css" />
		<style type="text/css">
			/*下面两项是重置muicss的输入框label和input之间的宽比率*/
			
			.mui-input-row label {
				width: 20%;
			}
			
			.mui-input-row label~input {
				width: 80%;
			}
		</style>
	</head>

	<body style="background-color: #FFFFFF;">
		
		<header class="mui-bar mui-bar-nav own-main-background-color">
			<button type="button" class="mui-action-back mui-btn  mui-btn-link mui-pull-left own-button">
			<!--<span class="mui-action-back mui-icon mui-icon-left-nav own-left-nav-color"></span>-->
			<span class="own-left-nav-color">返回</span>
		</button>
			<h1 class="mui-title">设置密码</h1>
		</header>

		<div class="mui-content" style="background-color: #FFFFFF;">

			<div class="mui-content own-content-padding" style="background-color: #FFFFFF;">
				<div class="mui-card" style="margin-top: 30px; border: solid 1px #04bb21 ;">
					<form class="mui-input-group">
						<div class="mui-input-row">
							<label><span class="mui-icon mui-icon-locked"></span></label>
							<input id="passWrod" class="mui-input-clear" type="text" placeholder="请设置登录密码" />

						</div>
					</form>
				
				</div>
				<p class="mui-text-center" style="margin-top: 20px; font-size: 14px; color: #525753;">请设置6个以上任意字符并且不能超过18位;</p>
				<div class="mui-button-row" style="margin: 10px 15px;">

					<button type="button" id="registers" class="mui-btn mui-btn-block own-btn-green" style="padding: 5px 0px;">完成注册</button>
				</div>
			</div>

		</div>

		<script type="text/javascript" src="../js/own.js"></script>
		<script src="../js/mui.min.js"></script>
		<script type="text/javascript">
			mui.plusReady(function() {
				var registers = document.getElementById("registers");
				registers.addEventListener("tap", function() {
						var pw = document.getElementById("passWrod").value;
						if(pw.length < 6 || pw.length > 18) {
							mui.alert("密码至少6位字符且不能超过18位字符");
						} else {
							var data = {};
							data.account = plus.storage.getItem("userName");
							data.password = pw;
							data.code = plus.storage.getItem("code");

							mui.ajax(url + 'rest/registerSrv', {
								data: data,
								dataType: 'json', //服务器返回json格式数据
								type: 'post', //HTTP请求类型
								timeout: 10000, //超时时间设置为10秒；
								success: function(result) {

									if(result.status != '0') {
										mui.alert(result.msg);
									} else {
										mui.openWindow({
												url: '../index.html',
												id: '../index.html'
										});
										
									}

								},
								error: function(xhr, type, errorThrown) {
									//异常处理；
									console.log(type);
								}
							});

						}
				});
			});
		</script>
	</body>

</html>